home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Source Code
/
Visual Basic Source Code.iso
/
vbsource
/
fromdl
/
fromdll.frm
< prev
next >
Wrap
Text File
|
1995-01-19
|
5KB
|
200 lines
VERSION 2.00
Begin Form Form1
BackColor = &H00C0C0C0&
Caption = "From a DLL"
ClientHeight = 5700
ClientLeft = 1125
ClientTop = 2715
ClientWidth = 7245
Height = 6105
Icon = FROMDLL.FRX:0000
Left = 1065
LinkTopic = "Form1"
ScaleHeight = 5700
ScaleWidth = 7245
Top = 2370
Width = 7365
Begin PictureBox Picture2
Height = 2895
Left = 3720
ScaleHeight = 2865
ScaleWidth = 3405
TabIndex = 8
Top = 2460
Width = 3435
End
Begin CommandButton btnClearPic
Caption = "Clear Picture"
Height = 495
Left = 1980
TabIndex = 7
Top = 1860
Width = 1695
End
Begin CommandButton btnPic
Caption = "Load &Picture"
Height = 495
Left = 180
TabIndex = 6
Top = 1860
Width = 1695
End
Begin PictureBox Picture1
AutoRedraw = -1 'True
Height = 2895
Left = 180
ScaleHeight = 191
ScaleMode = 3 'Pixel
ScaleWidth = 227
TabIndex = 5
Top = 2460
Width = 3435
End
Begin CommandButton btnCallDll
Caption = "Call DLL"
Height = 495
Left = 180
TabIndex = 4
Top = 1200
Width = 1695
End
Begin CommandButton btnStr2
Caption = "String 2"
Height = 495
Left = 1980
TabIndex = 3
Top = 600
Width = 1695
End
Begin CommandButton btnStr1
Caption = "String 1"
Height = 495
Left = 180
TabIndex = 2
Top = 600
Width = 1695
End
Begin TextBox Text1
Height = 285
Left = 180
TabIndex = 1
Top = 180
Width = 6975
End
Begin CommandButton btnExit
Caption = "E&xit"
Height = 495
Left = 5880
TabIndex = 0
Top = 1200
Width = 1215
End
Begin Label Label2
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "Copied from other Picture"
Height = 195
Left = 3720
TabIndex = 10
Top = 5400
Width = 2175
End
Begin Label Label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "Loaded from DLL"
Height = 195
Left = 180
TabIndex = 9
Top = 5400
Width = 1470
End
End
Option Explicit
Sub btnCallDll_Click ()
Dim r%
r% = SayHi()
End Sub
Sub btnClearPic_Click ()
picture2.Picture = LoadPicture()
picture1.Picture = LoadPicture()
End Sub
Sub btnExit_Click ()
FreeLibrary (DLLID%)
End
End Sub
Sub btnPic_Click ()
Dim hMyBitmap%, hdcmemory%
Dim r%, dccontrol%, cx%, cy%, pict1%
picture1.ScaleMode = 3
dccontrol% = picture1.hDC
cx% = picture1.ScaleWidth
cy% = picture1.ScaleHeight
' load bitmap from DLL
hMyBitmap% = LoadBitmap(DLLID%, "CPARROW")
' Create context compatible with the picture box
hdcmemory% = CreateCompatibleDC(dccontrol%)
' select bitmap into device context
r% = SelectObject(hdcmemory%, hMyBitmap%)
' Copy it
r% = BitBlt(dccontrol%, 0, 0, cx%, cy%, hdcmemory%, 0, 0, SRCCOPY)
picture1.Picture = picture1.Image ' move presistent image to visible
picture2.Picture = picture1.Picture ' prove it can be moved
r% = DeleteDC(hdcmemory%) ' delete device context
r% = DeleteObject(hMyBitmap%) ' delete object (free memory!)
End Sub
Sub btnStr1_Click ()
Dim temp$, r%
temp$ = Space(80)
r% = LoadString(DLLID%, 1, temp$, Len(temp$))
text1 = Trim(temp$)
End Sub
Sub btnStr2_Click ()
Dim temp$, r%
temp$ = Space(80)
r% = LoadString(DLLID%, 2, temp$, Len(temp$))
text1 = Trim(temp$)
End Sub
Sub Form_Load ()
DLLID% = LoadLibrary("TEST.DLL")
If DLLID% < 32 Then
MsgBox "Error loading DLL"
End
End If
End Sub